//
//  AnnotationModel.m
//  DingDongXiChe
//
//  Created by wtjr on 2017/11/21.
//  Copyright © 2017年 xieyingze. All rights reserved.
//

#import "ServiceModel.h"

@implementation ServiceModel

- (instancetype)initWithDictionaty:(NSDictionary *)dic {
    self = [super init];
    if (self) {
        _service_uuid = dic[@"service_uuid"];
        _service_title = dic[@"service_title"];
        _service_phone = dic[@"service_phone"];
        _service_description = dic[@"service_description"];
        _service_location = dic[@"service_location"];
        _service_shopUrl = dic[@"service_shopUrl"];
    
        _service_longitude   = [dic[@"service_longitude"] doubleValue];
        _service_latitude  = [dic[@"service_latitude"] doubleValue];
    }
    return self;
}

- (void)setCurrentCoordiante:(CLLocationCoordinate2D)currentCoordiante {
    //1.将两个经纬度点转成投影点
    MAMapPoint point1 = MAMapPointForCoordinate(currentCoordiante);
    MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(_service_latitude,_service_longitude));
    //2.计算距离
    CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2);
    _distance = distance;
}

@end
